package com.luoyuanxiangvip.web.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.luoyuanxiangvip.common.utils.AjaxResult;
import com.luoyuanxiangvip.common.vo.support.QueryPage;
import com.luoyuanxiangvip.core.entity.BizLinks;
import com.luoyuanxiangvip.core.service.IBizLinksService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 友情链接 前端控制器
 * </p>
 *
 * @author luoyuanxiang <p>luoyuanxiangvip.com</p>
 * @since 2019-06-18
 */
@RestController
@Api(description = "友情链接管理")
public class BizLinksController {

    @Resource
    @Lazy
    private IBizLinksService iBizLinksService;

    @PostMapping("/links/list")
    @ApiOperation(value = "获取友链列表")
    public AjaxResult linksList(@RequestBody QueryPage queryPage) {
        IPage<BizLinks> page = iBizLinksService.page(new Page<>(queryPage.getPage(), queryPage.getLimit()),
                new QueryWrapper<BizLinks>().eq("status", true));
        return AjaxResult.success("获取友链列表成功", page);
    }
}
